package com.hl.card.modular.packBack.service.impl;

import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.hl.card.common.persistence.dao.JoinRebateMapper;
import com.hl.card.common.persistence.model.JoinRebate;
import com.hl.card.modular.packBack.service.IJoinRebateService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author huangpu
 * @since 2018-06-06
 */
@Service
public class JoinRebateServiceImpl extends ServiceImpl<JoinRebateMapper, JoinRebate> implements IJoinRebateService {

    @Resource(name = "joinRebateMapper")
    private JoinRebateMapper joinRebateMapper;

    @Override
    public List<Map<String, Object>> selectList() {
        List<Map<String, Object>> map = joinRebateMapper.selectJoin();
        return map;
    }

    @Override
    public void save(JoinRebate joinRebate) {
        joinRebateMapper.insert(joinRebate);
    }

    @Override
    public void delete(int id) {
        joinRebateMapper.deleteById(id);
    }

    @Override
    public void update(JoinRebate joinRebate) {
        joinRebateMapper.updateById(joinRebate);
    }

    @Override
    public JoinRebate selectById(Integer id) {
        JoinRebate joinRebate = joinRebateMapper.selectById(id);
        return joinRebate;
    }

    @Override
    public JoinRebate selectByCode(String code) {
        JoinRebate joinRebate =  joinRebateMapper.selectByCode(code);
        return joinRebate;
    }
}
